// Set local variables

ENT.Type = "anim"
ENT.Base = "base_gmodentity"

ENT.PrintName		= "Toggleable Hoverball"
ENT.Author			= ""
ENT.Contact			= ""
ENT.Purpose			= ""
ENT.Instructions	= ""

ENT.Spawnable			= false
ENT.AdminSpawnable		= false

// Get the Z target

function ENT:GetTargetZ()
	if (CLIENT || !self.TargetZ) then
		return self.Entity:GetNetworkedInt("TargetZ", 10)
	end

	return self.TargetZ
end

// Set Z target

function ENT:SetTargetZ(Z)
	self.TargetZ = Z
end

// Get the speed of the hoverball

function ENT:GetSpeed()
	if (!SinglePlayer()) then
		return math.Clamp(self.Entity:GetNetworkedFloat( 0 ), 0, 10)
	end

	return self.Entity:GetNetworkedFloat(0)
end

// Set the speed of the hoverball

function ENT:SetSpeed(S)
	self.Entity:SetNetworkedFloat(0, S)
	
	self:UpdateLabel()
end

// Update the label

function ENT:UpdateLabel()
	self:SetOverlayText(string.format("Speed: %i\nResistance: %.2f", self:GetSpeed(), self:GetAirResistance()))
end
